package train48days;

public class 最近公共祖先 {
    public int getLCA(int a, int b) {
        if (a == b){
            return a;
        }
        while (a!=b){
            if (a>b){
                a=a/2;
            }else if (a<b){
                b=b/2;
            }
        }
        return a;
    }
}
